<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>我的购物车</title>
	<link rel="stylesheet" href="http://127.0.0.1/yhd/Application/Index/View/Public/css/cart.css">
	<script src="http://127.0.0.1/yhd/Application/Index/View/Public/js/jquery-1.7.2.min.js"></script>
	<script src="http://127.0.0.1/yhd/Application/Index/View/Public/js/cart.js"></script>
	<link rel="stylesheet" type="text/css" href="http://127.0.0.1/yhd/Static/hdjs/hdjs.css"/>
    <script src="http://127.0.0.1/yhd/Static/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<!-- 头部开始 -->
   <div id="top">
	<div class="header">
	 <div class="l">
	     <?php if(!isset($hd['session']['username'])){ ?>
  <span>&nbsp;Hi,请<a href="<?php echo U('User/login');?>">登录</a>/<a href="<?php echo U('User/register');?>">注册</a></span>
    <?php }else{ ?>
   <span style="">&nbsp;<span><?php echo $hd['session']['username'];?>,</span><a href="<?php echo U('User/out');?>">退出</a></span>
    <?php } ?>
	 </div>
	 <div class="r">
	 	<a href="">帮助中心</a>
	 </div>
		
	</div>
	</div>
	<!-- 头部结束 -->
 <!-- 购物车部分开始 -->
	<div class="cart_content">
		<div class="cart">
			<div class="cart_head">
				<a href="" class="logo"><img src="http://127.0.0.1/yhd/Application/Index/View/Public/images/logo1.png" alt="" width="54" height="48"></a>
				<div class="cart_step1"></div>
				<div class="continue">
					<h3>购物车</h3>
					<a href="<?php echo U('Index/Index');?>" class="goshopping">继续购物&nbsp;></a>
					<div class="area_select"></div>
				</div>
			</div>

			<div class="cart_area">
			<form action="<?php echo U('Order/index');?>" method="post">
				<div class="tit">
					<div class="index">
                    <em class="ico"></em>
                 <!--    <input type="checkbox" name="id[]" id="" class="checkbox" checked="checked" >	 -->


					<a href="">1号店</a>
					</div>
					<em class="line"></em>
					<span class="price">单价</span>
					<em class="line"></em>
					<span class="num">数量</span>
					<em class="line"></em>
					<span class="width_90">合计</span>
					<em class="line"></em>
					<!-- <span class="width_90">重量</span>
					<em class="line"></em> -->
					<span class="" style="margin-left:18px;">操作</span>
				</div>
				      <?php if(!isset($_SESSION['cart'])||$_SESSION['cart']['total']==0){ ?>
				  <p style="text-align:center;margin-bottom:50px;"> 亲，您的购物车空空如也，赶快去购物吧！</p>
				  <?php }else{ ?>
				<div class="cart_list">
				<?php foreach ($goods as $k=>$v){?>
					<ul >
						<li>
						<!-- <input type="text" name="sid" value="<?php echo $k;?>"> -->
			<input type="checkbox"   class="option" checked="checked"  name="sid[]" value="<?php echo $k;?>">	
			<a href="" class="pic"><img src="http://127.0.0.1/yhd/<?php echo $v['options']['goods_img'];?>" alt=""></a>
							<span class="title">
								<a href=""><?php echo $v['name'];?></a>
<strong class="tips">该商品已下架或无库存</strong>

							</span>
							<span class="price">
								¥<ins><?php echo $v['price'];?></ins>
							</span>
							<div class="num">
							<a href="javascript:;" class="reduceGoods"></a>
					<input type="text" name="number[]" gid="<?php echo $v['id'];?>" class="shuliang"  value="<?php echo $v['num'];?>"  url="<?php echo U('Cart/edit');?>" sid="<?php echo $k;?>">
								<a href="javascript:;" class="addGoods"></a>
								<br>
							<!-- 	<em class="stock">库存紧张</em> -->
							<!-- <input type="text" name="sid" id="" value="<?php echo $k;?>" class="sid"/> -->

							</div>
							<span class="count">
								¥<strong><?php echo $v['total'];?></strong>
							</span>
							<!-- <span class="weight"><span>0.202kg</span></span> -->
							<span class="btn">
								<!-- <a href="" class="favorites">移入收藏</a>
								<br> -->
							<a href="javascript:;" class="del hd-btn hd-btn-danger" url="<?php echo U('Cart/delOne');?>" >删除</a>
							<!-- <?php echo U('Cart/delOne');?>/sid/<?php echo $k;?> -->
							</span>
						</li>

					</ul>
					<?php }?>
					<!-- <div class="freight">
						<span class="num">运费<strong>¥0</strong></span>
						<span class="amount">商品金额<strong>¥143.5</strong></span>
						<span class="weight">重量合计<strong>4.3kg</strong></span>
						<span class="save"></span>
					</div> -->
				</div>

				<!-- 结算信息浮动条 -->
				<div class="inner">
					<div class="inner_l"></div>
					<span class="select_all">
						<em class="ico"></em>
						
						<input type="checkbox"  id="" class="checkbox all" checked="checked"  >
						<label for=""><a href="javascript:;">全选</a></label>
					</span>
					<div class="remove">
						<a href="javascript:hd_modal_del()" class="del">清空购物车</a>
					</div>
					<div class="inner_r">
						<!-- <span class="amount"> 运费(以结算页为准)	<br>
						<em><span>¥</span>0</em>	
						</span> -->
						<span class="add">+</span>
						<span class="amount total">
						<input type="hidden" name="" id="" value="<?php echo $total;?>" class="zongjia"/>
							<span class="total">商品总价</span>
							<br>
							¥<span class="price"><?php echo $total;?></span>
						</span>
						<!-- <span class="continue">
							<a href="<?php echo U('Order/index');?>">确认结算<em></em></a>
						</span> -->
						<input type="submit" value="确认结算" class="submit" />
					</div>
					<em class="shadow_top"></em>
					<em class="shadow_bot"></em>
				</div>
				<!-- 结算信息浮动条end -->
             <?php } ?>
			</div>
           </form>
           <script type="text/javascript">
           // $(function(){
           //  $('.submit').click(function(){
           //  var uid=<?php echo $hd['session']['uid'];?>;
           //   if(!uid){
           //     alert("你还未登录，请先登录");
           //     location.href=''
           //   }


           //  })
             

           // })
  

           </script>
		</div>
		<!-- 购物车结束 -->
	</div>
	<div class="footer">
    <p><a href="">沪ICP备13044278号</a>| <a href="">营业执照</a></p>
<p>Copyright© 1号店网上超市 2007-2015， All Rights Reserved</p>

	</div>

	<script type="text/javascript">
	function hd_modal_del(id) {
        hd_modal({
            width: 400,//宽度
            height: 150,//高度
            title: '确认把购物车清空吗？',//标题
            content: '',//提示信息
            button: true,//显示按钮
            button_success: "确定",//确定按钮文字
            button_cancel: "取消",//关闭按钮文字
            timeout: 0,//自动关闭时间 0：不自动关闭
            shade: false,//背景遮罩
            shadeOpacity: 0.4,//背景透明度
            success: function () {
            	//点击确定后的事件
            	//http://127.0.0.1/hdphp/index.php/Admin/Category&a=del&cid=id
				location.href = "http://127.0.0.1/yhd/index.php/Index/Cart" + '&a=delALLCart&sid=' + id;
            },
            cancel: function () {//点击关闭后的事件
				
            }
        });
    }
</script>
</body>
</html>